package com.example.kotlinlearningproject.network

import android.util.Log
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

private const val TAG = "NetworkHelper"
class NetworkHelper {

    fun translate() {
        TranslateService.getApi().create("DGH","Developer").
        enqueue(object:Callback<UserResult>{
            override fun onResponse(call: Call<UserResult>, response: Response<UserResult>) {
                var user = response.body()
                if (user != null) {
                    Log.d(TAG, "${user.id}  ${user.name} ${user.job} ${user.createdAt}")
                }
            }

            override fun onFailure(call: Call<UserResult>, throwable: Throwable) {
                println(throwable.message)
            }
        })
    }

}

